package dapps.entity.proj;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.modules.utils.DateUtils;

import dapps.entity.IdEntity;
import dapps.entity.user.User;

@Entity
@Table(name = "proj")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Proj extends IdEntity {

	private static final long serialVersionUID = -172749047563230854L;

	public Proj() {
		this.forced = 0;
		this.sl = 0;
		this.zd = 0;
		this.bb = 0;		
		this.cgtsb = 0;
		this.cgtsj = 0;
		this.pgtsj = 0;
		this.sgtpf = 0;
		this.jzfrom = 0l;this.jzto = 0l;
	}

	@Column(nullable = false, unique = true)
	private String title;

	private String comp;

	@Column(length = 200)
	private String code;

	private Type type;
	private User dutycomp;
	private User applicateuser;
	
	@Column(length = 500)
	private String content;

	@Column(length = 500)
	private String position;

	private Long invest;
	private Double area;
	private Double agrarea;
	private Double farmingarea;
	private Long contentlength;
	private Long contentwidth;
	private Long contentarea;
	
	
	private String jys;
	private String ky;
	private String sj;
	private String xz;
	private String ydxk;
	private String ydys;
	private String hp;

	@Column(length = 500)
	private String note;
	private Integer zd;
	private Integer bb;
	private Integer sl;
	
	private Integer cgtsb;
	private Integer cgtsj;
	private Integer pgtsj;
	private Integer sgtpf;
	private String sgtpfwh;

	private Integer prorank;
	private Integer forced;
	private Integer yeartime;
	private Integer applicate;
	private Long jzfrom;
	private Long jzto;
	@Column(insertable = true, updatable = false)
	private Date insertDate = DateUtils.getCurrentDateTime();

	@Column(insertable = false, updatable = true)
	private Date updateDate;

	@Transient
	private static String[] prorankname = { "实施", "预备", "储备","拟争取省留指标" };

	@Transient
	private static String[] applicatename = { "申报", "补报" };

	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "type_id")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Type getType() {
		return type;
	}

	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "user_id")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public User getDutycomp() {
		return dutycomp;
	}

	public void setDutycomp(User dutycomp) {
		this.dutycomp = dutycomp;
	}

	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "applicateuser_id")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public User getApplicateuser() {
		return applicateuser;
	}

	public void setApplicateuser(User applicateuser) {
		this.applicateuser = applicateuser;
	}

	public Integer getYeartime() {
		return yeartime;
	}

	public void setYeartime(Integer yeartime) {
		this.yeartime = yeartime;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}


	public Long getJzfrom() {
		return jzfrom;
	}

	public void setJzfrom(Long jzfrom) {
		this.jzfrom = jzfrom;
	}

	public Long getJzto() {
		return jzto;
	}

	public void setJzto(Long jzto) {
		this.jzto = jzto;
	}

	public Date getInsertDate() {
		return insertDate;
	}

	public void setInsertDate(Date insertDate) {
		this.insertDate = insertDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}



	public Integer getForced() {
		return forced;
	}

	public void setForced(Integer forced) {
		this.forced = forced;
	}

	public Integer getProrank() {
		return prorank;
	}

	public void setProrank(Integer prorank) {
		this.prorank = prorank;
	}

	@Transient
	public String getProrankname() {
		return prorankname[prorank];
	}

	@Transient
	public String getApplicatename() {
		return applicatename[applicate];
	}

	public Integer getCgtsb() {
		return cgtsb;
	}

	public void setCgtsb(Integer cgtsb) {
		this.cgtsb = cgtsb;
	}

	public Integer getCgtsj() {
		return cgtsj;
	}

	public void setCgtsj(Integer cgtsj) {
		this.cgtsj = cgtsj;
	}

	public Integer getPgtsj() {
		return pgtsj;
	}

	public void setPgtsj(Integer pgtsj) {
		this.pgtsj = pgtsj;
	}

	public Integer getSgtpf() {
		return sgtpf;
	}

	public void setSgtpf(Integer sgtpf) {
		this.sgtpf = sgtpf;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getComp() {
		return comp;
	}

	public void setComp(String comp) {
		this.comp = comp;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public Long getInvest() {
		return invest;
	}

	public void setInvest(Long invest) {
		this.invest = invest;
	}

	public Double getArea() {
		return area;
	}

	public void setArea(Double area) {
		this.area = area;
	}

	public Double getAgrarea() {
		return agrarea;
	}

	public void setAgrarea(Double agrarea) {
		this.agrarea = agrarea;
	}

	public Double getFarmingarea() {
		return farmingarea;
	}

	public void setFarmingarea(Double farmingarea) {
		this.farmingarea = farmingarea;
	}

	public String getJys() {
		return jys;
	}

	public void setJys(String jys) {
		this.jys = jys;
	}

	public String getKy() {
		return ky;
	}

	public void setKy(String ky) {
		this.ky = ky;
	}

	public String getSj() {
		return sj;
	}

	public void setSj(String sj) {
		this.sj = sj;
	}

	public String getXz() {
		return xz;
	}

	public void setXz(String xz) {
		this.xz = xz;
	}

	public String getYdxk() {
		return ydxk;
	}

	public void setYdxk(String ydxk) {
		this.ydxk = ydxk;
	}

	public String getYdys() {
		return ydys;
	}

	public void setYdys(String ydys) {
		this.ydys = ydys;
	}

	public String getHp() {
		return hp;
	}

	public void setHp(String hp) {
		this.hp = hp;
	}

	public Integer getZd() {
		return zd;
	}

	public void setZd(Integer zd) {
		this.zd = zd;
	}

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public Integer getApplicate() {
		return applicate;
	}

	public void setApplicate(Integer applicate) {
		this.applicate = applicate;
	}

	public Integer getBb() {
		return bb;
	}

	public void setBb(Integer bb) {
		this.bb = bb;
	}

	public Integer getSl() {
		return sl;
	}

	public void setSl(Integer sl) {
		this.sl = sl;		
	}

	public String getSgtpfwh() {
		return sgtpfwh;
	}

	public void setSgtpfwh(String sgtpfwh) {
		this.sgtpfwh = sgtpfwh;
	}

	
	public Long getContentlength() {
		return contentlength;
	}

	public void setContentlength(Long contentlength) {
		this.contentlength = contentlength;
	}

	public Long getContentwidth() {
		return contentwidth;
	}

	public void setContentwidth(Long contentwidth) {
		this.contentwidth = contentwidth;
	}

	public Long getContentarea() {
		return contentarea;
	}

	public void setContentarea(Long contentarea) {
		this.contentarea = contentarea;
	}

	@Override
	public String toString() {
		return this.title;
	}

}
